package main

import (
	"fmt"
	"time"
)

func slowTask() chan bool {
	ch:=make(chan bool)
	go func() {
		time.Sleep(time.Millisecond * 500)
		ch <- true
	}()
	return ch
}

func main() {
	select {
		case <- slowTask():
			fmt.Println("slow task done")
		case <- time.After(100*time.Millisecond):
			fmt.Println("timeout")
	}
}
